package com.test.pudamoney.view_pudamoney.info_input_pudamoney;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.test.pudamoney.R;
import com.test.pudamoney.bean_pudamoney.process_pudamoney.ProcessData_pudamoney;
import com.test.pudamoney.util_pudamoney.StringUtil_pudamoney;
import com.test.pudamoney.view_pudamoney.base_pudamoney.BaseInfoInputViewManager_pudamoney;

public class CreditReportViewManager_Niri_pudamoney extends BaseInfoInputViewManager_pudamoney {

    private View clickView;
    private TextView titleTv;
    private ImageView checkIb;
    private TextView textTv;

    private boolean isCheck = false;

    public CreditReportViewManager_Niri_pudamoney(View view, ProcessData_pudamoney data){
        super(view,data);
    }

    @Override
    protected void init(){

        clickView = mView.findViewById(R.id.view_credit_report_layout_click);
        titleTv = mView.findViewById(R.id.view_credit_report_tv_title);
        checkIb = mView.findViewById(R.id.view_credit_report_iv_check);
        textTv = mView.findViewById(R.id.view_credit_report_tv_text);

        titleTv.setText(mData.getTitle());
        textTv.setText(StringUtil_pudamoney.getSafeString(mData.getHint()));

        clickView.setOnClickListener(v -> {
            checkIb.setBackgroundResource(isCheck ? R.drawable.icon_item_check_false:R.drawable.icon_item_check_true);
            isCheck = !isCheck;
        });
    }


    @Override
    public boolean checkInput() {
        if (!mData.isMustInput()) return true;
        return isCheck;
    }

    @Override
    public String getInput() {
        return isCheck ? "YES":"NO";
    }

}
